home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / a_utils / ffccflow / ffccflow.lha / ffccc+flow / flow / flow.exec < prev    next >
Text File  |  1992-07-31  |  6KB  |  220 lines

  1. /***********************************************************************/
  2. /* FLOW exec                                                           */
  3. /*                                                                     */
  4. /* JJB July 1989                                                       */
  5. /***********************************************************************/
  6. address 'COMMAND'
  7. signal on novalue
  8. parse source . . execname .
  9.  
  10. optset = "COMMON_TABLE STRUCTURE_CHART GRAPHICS NODE"
  11. sngset = "QUERY EXTERNALS"
  12. LOG = 'Y'
  13. err = ' '
  14. do i = 1 to words(optset)
  15.    interpret word(optset,i) " = ' '"
  16. end
  17. do i = 1 to words(sngset)
  18.    interpret word(sngset,i) " = 'NO'"
  19. end
  20.  
  21. interactive = "YES"
  22. parse upper arg input
  23. parse value input with filename '(' options
  24. if filename = "?" then do; ADDRESS CMS 'HELP 'execname; signal EXIT; end
  25. err = "Fill in the blank field(s) as required."
  26. cursor = "0001"
  27.  
  28. if options ^= ' ' then do
  29.    interactive = "NO"
  30.    nopts = words(options)
  31.    iopt = 0 ; err = " "
  32.    do forever
  33.       iopt = iopt + 1 ; if iopt > nopts then leave
  34.       if find(sngset,word(options,iopt)) ^= 0 then do
  35.          interpret word(options,iopt)||'="YES"'
  36.          iterate
  37.       end
  38.       if iopt < nopts then do
  39.          val2 = ' ' ; val3 = ' '
  40.          key = word(options,iopt) ; val1 = word(options,iopt+1)
  41.          if find(optset,key) = 0 then do
  42.             err = "Unidentified option on command line: "key
  43.             signal EXIT
  44.          end
  45.          if iopt + 1 < nopts then val2 = word(options,iopt+2)
  46.          if iopt + 2 < nopts then val3 = word(options,iopt+3)
  47.          if find(optset,val2) ^= 0 | find(sngset,val2) ^= 0 then do
  48.             val2 = ' ' ; val3 = ' '
  49.          end
  50.          if find(optset,val3) ^= 0 | find(sngset,val3)^=0 then val3 = ' '
  51.          interpret key "= '"val1 val2 val3"'"
  52.          iopt = iopt + words(val1 val2 val3)
  53.          iterate
  54.       end
  55.       if iopt = nopts then do
  56.          err = 'Missing value for option 'word(options,iopt)
  57.          signal EXIT
  58.       end
  59.    end
  60. end
  61.  
  62. /****************/
  63. /* GENERAL MODE */
  64. /****************/
  65.  
  66. if interactive = "NO" then signal CHECK
  67. if ^'QCONSOLE'('GRAPHIC') then do
  68.    err = 'Not a full screen device'
  69.    signal EXIT
  70. end
  71. START:
  72. do forever
  73.    signal off error
  74.    'IOS3270' execname 'PANEL ;PANEL1 (CLEAR 'cursor
  75. /* signal on error    ios3270 gives codes that aren't errors...*/
  76.    if IOSK = 'PF03' then do; err = ' '; signal EXIT; end
  77.    if IOSK = 'PF02' then do
  78.       say "Enter the CMS command :"
  79.       parse pull command
  80.       signal off error; ADDRESS CMS command; signal on error
  81.       say "Continue with "execname" ? [CR=YES]"
  82.       parse upper pull answer
  83.       if abbrev(answer,"N",1) then signal EXIT
  84.       iterate
  85.    end
  86.    if IOSK = 'PF01' then do
  87.       ADDRESS CMS 'HELP 'execname
  88.    end
  89.    leave
  90. end
  91.  
  92. CHECK:
  93. err = ' '
  94. do i = 1 to words(optset)
  95.    interpret "upper "word(optset,i)
  96. end
  97. do i = 1 to words(sngset)
  98.    interpret "upper "word(sngset,i)
  99. end
  100.  
  101. intree = filename
  102. if words(intree) = 2 then intree = intree "*"
  103. if words(intree) = 1 then intree = intree "FLOPTRE *"
  104.  
  105. if intree ^= " " then do
  106.    if ^'FEXIST'(intree) then do
  107.       err = "Binary file "intree" does not exist."
  108.       cursor = "0001"
  109.       if interactive = "YES" then signal START
  110.       signal EXIT
  111.    end
  112. end
  113.  
  114. if words(common_table) = 2 then common_table = common_table "A"
  115. if words(common_table) = 1 then common_table = common_table "COMMONS A"
  116.  
  117. if words(structure_chart) = 2 then structure_chart = structure_chart "A"
  118. if words(structure_chart) = 1 then structure_chart = structure_chart "CHART A"
  119.  
  120. if words(graphics) = 2 then graphics = graphics "A"
  121. if words(graphics) = 1 then do
  122.    graphics = graphics "LISTPS A"
  123. end
  124.  
  125. if node ^= ' ' & graphics = ' ' & structure_chart = ' ' then do
  126.    err = "You must specify a file name for either graphics or text."
  127.    cursor = "0004"
  128.    if interactive = "YES" then signal START
  129.    signal EXIT
  130. end
  131.  
  132.  
  133. if graphics = ' ' & query = 'NO' & structure_chart = ' ',
  134.    & common_table = ' ' then do
  135.    err = "There is nothing for FLOW to do !"
  136.    cursor = "0001"
  137.    if interactive = "YES" then signal START
  138.    signal EXIT
  139. end
  140.  
  141. 'CLRSCRN'
  142.  
  143. /* Now assign the FILEDEFs */
  144. 'MAKEBUF'
  145. bufno = rc
  146. 'SENTRIES'
  147. entries = rc
  148. 'QFILEDEF ( STACK'
  149. pull dummy
  150. num_fdefs = 0
  151. do queued()-entries
  152.    num_fdefs = num_fdefs + 1
  153.    pull fdef.num_fdefs
  154. end
  155. 'DROPBUF 'bufno
  156.  
  157. control = ' '
  158. say "FLOW: Input binary file "intree
  159. 'FILEDEF 50 DISK 'intree' (LRECL 8000 RECFM VS'
  160. if common_table ^= " " then do
  161.    say "      COMMON block usage table "common_table
  162.    'FILEDEF 60 DISK 'common_table' (LRECL 132 RECFM F'
  163.    control = control||' common'
  164. end
  165. if structure_chart ^= " " then do
  166.    say "      Text version of chart will be "structure_chart
  167.    'FILEDEF 61 DISK 'structure_chart' (LRECL 132 RECFM F'
  168.    control = control||' chart'
  169. end
  170. if graphics ^= ' ' then do
  171.    say "      Graphics version of chart will be "graphics
  172.    'FILEDEF 96 DISK 'graphics' (LRECL 80 RECFM F'
  173.    control = control||' graphics'
  174. end
  175. if externals ^= 'NO' then do
  176.    say "      External routine names will be displayed"
  177.    control = control||' externals'
  178. end
  179. if query ^= 'NO' then do
  180.    say "      You will explore the tree interactively"
  181.    control = control||' query'
  182. end
  183. if node ^= ' ' then,
  184.    say "      The tree will start at node "node
  185. else node = '$$$$'
  186. control = control||' node '||node
  187. if 'FEXIST'('FLOW$TMP CONTROL A') then 'ERASE FLOW$TMP CONTROL A'
  188. 'EXECIO 1 DISKW FLOW$TMP CONTROL A 1 F (FINIS STRING 'control
  189. 'FILEDEF 1 DISK FLOW$TMP CONTROL A '
  190.  
  191. say 'FLOW begins .... '
  192. 'LOAD CMSFLOW (CLEAR START'
  193. 'ERASE FLOW$TMP CONTROL A'
  194. 'FILEDEF 1 CLEAR'
  195. 'FILEDEF 50 CLEAR'
  196. if graphics ^= ' ' then 'FILEDEF 96 CLEAR'
  197. if common_table ^= ' ' then 'FILEDEF 60 CLEAR'
  198. if structure_chart ^= ' ' then 'FILEDEF 61 CLEAR'
  199.  
  200. /* Reinstate original FILEDEFs */
  201. do i = 1 to num_fdefs
  202.    fdef.i
  203. end
  204. say 'FLOW has finished'
  205.  
  206. call EXIT
  207.  
  208.  
  209. NOVALUE:
  210. say 'Uninitialised variable encountered on line' sigl
  211. call EXIT
  212.  
  213. ERROR:
  214. say 'Error on line' sigl
  215. call EXIT
  216.  
  217. EXIT:
  218. if err ^= " " then say execname ": " err
  219. exit
  220.